<h1>Resourse shared by:</h1>

<h2><%= @user.username%></h2>


<%= link_to 'New resource', new_resource_path %>

<% for resource in @resources %>


<a name="res_<%= resource.id.to_s %>"></a>
	<div id="res_<%= resource.id.to_s %>" class="resource">
	
		<span id="res_title"><%= link_to resource.title, resource.link, :popup=>true %></span>
			
		<%= resource.voting_interface %>
		<% if resource.isNewResource() then %> 
			<%= image_tag("new-blink.gif") %> 
		<% end %>
		<% if (resource.hasVideo() or resource.hasAudio()) then %> 
			<%= link_to image_tag("video-icon5.png", :title=>"Click to play"), resource %>
		<% end %>
		Added: <%= resource.created_at.to_formatted_s(:short) %>
		<p class="description"><b>Description: </b><%=h resource.displayShortDescription %></p>
		
		
    	<%= link_to 'Show', resource %>
    	<%= link_to 'Edit', edit_resource_path(resource) %>
    	<% if (not Favorite.isAFavorite((session[:user_id]),resource.id)) then %>
    	 <%= link_to image_tag("fav-add-1.png", :title=>"add to favourites") , :action => "addFavoriteResource" , :controller => "resources", :user_id => session[:user_id] , :id => resource.id %> 
    	 <% else %>
    	 <%= link_to image_tag("fav-del.png" , :title=>"remove from favourites" ), :action => "deleteFavoriteResource" , :controller => "resources", :user_id => session[:user_id] , :id => resource.id %>
    	 <% end %>
    	
		<!-- ADD COMMENT //-->
		<div id="comment_<%= resource.id.to_s %>">		
			<%= link_to_remote('Leave a comment', 
				:update=>"comment_"+resource.id.to_s, 
				:url=>{:controller=>"comments", :action=>"show_comment_input", :res_id=>resource.id},
				:success=>visual_effect(:slide_down, "comment_"+resource.id.to_s)
				) %>
		</div>
		<!-- READ COMMENTS //-->
		<div id="r_comment_<%= resource.id.to_s %>" class="r_comments">		
			<u><%= link_to_remote('Show comments', 
				:update=>"r_comment_"+resource.id.to_s, 
				:url=>{:controller=>"comments", :action=>"show_comments_of", :res_id=>resource.id},
				:success=>visual_effect(:slide_down, "r_comment_"+resource.id.to_s)
				) %></u>
		</div>
		there are <%= Comment.countComments(resource.id) %> comments
		<div id = "tags">
			<b>Tags:</b>
    		<% tags = resource.showResourceTags() %>
			<% for tag in tags %>
    		<%= link_to tag.name, :controller => "resources" , :action => "index" , :tag_id => tag.id %> |
		<% end %>
		</div> 
			<!--<%=h resource.user_id %>-->
	</div>


<% end %>
